﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>管理系统 - 管理中心</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- <meta ng-include="'head.html'"> -->
    <style type="text/css">
        .table>thead>tr>th{padding-bottom: 0px}
        .table tr>td>a{ color:#696969;}
        .titleHead { font-family: 宋体; font-size: 14px; font-weight: 400; margin-left: 5px }
    </style>
    <link rel="stylesheet" type="text/css" href="../lib/css/footable.bootstrap.min.css">
    <script src="../lib/js/jquery.min.js" type="text/javascript"></script>
    <script src="../js/build.js" type="text/javascript"></script>
    <script src="../js/public.js" type="text/javascript"></script>
</head>
<body class="flat-blue">
<div class="app-container" ng-app="myApp" ng-controller="myCtrl">
<div class="row content-container">
<div ng-include="'menus.html'" onload="loadReady()"></div>
<div class="container-fluid">
<div class="side-body padding-top" id="main" style="padding-top:65px">
    <!------------------Main---------------->
    <div style="width:99%; margin:0px 10px 20px 10px; height:100%;
            opacity:1;background-color:#fff; padding-left:20px">
        <div class="titleHead">➢公司预览</div>
        <table class="table table-striped"></table>

    </div>

    <!------------------End Main---------------------->
</div>  <!--End side-body-->
</div>  <!--End container-fluid-->
</div>  <!--End content-container-->
<div ng-include="'footer.html'"></div>
</div>  <!--End app-container-->

<script type="text/javascript" src="../lib/js/footable.min.js"></script>
<script language="javascript">
    var app = angular.module('myApp', []);
    app.controller('myCtrl', function($scope) {
        loadCtlBase($scope);

        if(parseInt(getCookie('level'))<2){
            alert("请您升级为高级会员，查看详情的数据！");
            window.location.href="userAccount.html";
            return;
        }

        loadCompanys("view1");
    });
    

    function loadTable(data){
        var cols = [{'name':'companyName', 'title':'公司名'}, 
            {'name':'province', 'title':'省'}, 
            {'name':'city', 'title':'城市'}, 
            {'name':'count', 'title':'设备数量'}
        ];
        function getHref(d, text){
            return "<a href='companyInfo.html?cp="+ escape(d.companyName) +"&pvn="
                   + escape(d.province) + "' title='点击查看详情'>" + text + "</a>"
        }
        var rows = data.map(function(d){
            return {
                companyName: getHref(d, d.companyName),
                province: d.province,
                city: d.city,
                count: getHref(d, d.count)
            };
        });
        $('.table').footable({
            "paging": { "enabled": true, 'size':13 },
            "filtering": { "enabled": true },
            "sorting": { "enabled": true },
            "columns": cols,
            "rows": rows
        });

    }

    function loadCompanys(id){
        ajaxData('get_company_list', {}, function(rst){
            var data = rst.data;
            loadTable(data)

        });
    }


</script>

</body>
</html>
